package cn.tedu.egmvc2.controller;

import cn.tedu.egmvc2.mapper.AddressMapper;
import cn.tedu.egmvc2.pojo.entity.Address;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/address/")
public class AddressController {
    @Autowired
    private AddressMapper addressMapper;

    @RequestMapping("insert")
    public String insert(Address address){
        addressMapper.insert(address);

        return "添加成功";
    }

    @RequestMapping("select")
    public List<Address> select(){
        return addressMapper.select();
    }

    @RequestMapping("delete")
    public String delete(Integer id){
        addressMapper.delete(id);

        return "删除成功";
    }

    @RequestMapping("update")
    public String update(Address address){
        addressMapper.update(address);

        return "修改成功";
    }
}









